<script setup>
  const {list} = defineProps({
    list:{
      type:Array
    },
  })
  const emit = defineEmits(['del'])
  const deltodo = (id)=>{
    emit('del',id)
  }

</script>

<template>
  <!-- 列表区域 -->
  <section class="main">
    <ul class="todo-list">
      <li class="todo" v-for="(item, index) in list" :key="item.id">
        <div class="view">
          <span class="index">{{ index + 1 }}.</span>
          <label>{{ item.name }}</label>
          <button @click="deltodo(item.id)" class="destroy"></button>
        </div>
      </li>
    </ul>
  </section>
</template>


<style>
</style>